/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package nxtmodel2.util;

import java.util.Map;

import nxtmodel2.*;

import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.common.util.DiagnosticChain;
import org.eclipse.emf.common.util.ResourceLocator;

import org.eclipse.emf.ecore.EPackage;

import org.eclipse.emf.ecore.util.EObjectValidator;

/**
 * <!-- begin-user-doc -->
 * The <b>Validator</b> for the model.
 * <!-- end-user-doc -->
 * @see nxtmodel2.Nxtmodel2Package
 * @generated
 */
public class Nxtmodel2Validator extends EObjectValidator {
	/**
	 * The cached model package
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static final Nxtmodel2Validator INSTANCE = new Nxtmodel2Validator();

	/**
	 * A constant for the {@link org.eclipse.emf.common.util.Diagnostic#getSource() source} of diagnostic {@link org.eclipse.emf.common.util.Diagnostic#getCode() codes} from this package.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see org.eclipse.emf.common.util.Diagnostic#getSource()
	 * @see org.eclipse.emf.common.util.Diagnostic#getCode()
	 * @generated
	 */
	public static final String DIAGNOSTIC_SOURCE = "nxtmodel2";

	/**
	 * A constant with a fixed name that can be used as the base value for additional hand written constants.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private static final int GENERATED_DIAGNOSTIC_CODE_COUNT = 0;

	/**
	 * A constant with a fixed name that can be used as the base value for additional hand written constants in a derived class.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected static final int DIAGNOSTIC_CODE_COUNT = GENERATED_DIAGNOSTIC_CODE_COUNT;

	/**
	 * Creates an instance of the switch.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Nxtmodel2Validator() {
		super();
	}

	/**
	 * Returns the package of this validator switch.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EPackage getEPackage() {
	  return Nxtmodel2Package.eINSTANCE;
	}

	/**
	 * Calls <code>validateXXX</code> for the corresponding classifier of the model.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected boolean validate(int classifierID, Object value, DiagnosticChain diagnostics, Map<Object, Object> context) {
		switch (classifierID) {
			case Nxtmodel2Package.NXT_ROBOT:
				return validateNxtRobot((NxtRobot)value, diagnostics, context);
			case Nxtmodel2Package.NXT_ELEMENT:
				return validateNxtElement((NxtElement)value, diagnostics, context);
			case Nxtmodel2Package.PART:
				return validatePart((Part)value, diagnostics, context);
			case Nxtmodel2Package.SENSOR:
				return validateSensor((Sensor)value, diagnostics, context);
			case Nxtmodel2Package.MOTOR:
				return validateMotor((Motor)value, diagnostics, context);
			case Nxtmodel2Package.PROPERTY:
				return validateProperty((Property)value, diagnostics, context);
			case Nxtmodel2Package.GEAR:
				return validateGear((Gear)value, diagnostics, context);
			case Nxtmodel2Package.PORT:
				return validatePort((Port)value, diagnostics, context);
			case Nxtmodel2Package.SENSOR_PORT:
				return validateSensorPort((SensorPort)value, diagnostics, context);
			case Nxtmodel2Package.MOTOR_PORT:
				return validateMotorPort((MotorPort)value, diagnostics, context);
			case Nxtmodel2Package.CONDITION:
				return validateCondition((Condition)value, diagnostics, context);
			case Nxtmodel2Package.RULE:
				return validateRule((Rule)value, diagnostics, context);
			case Nxtmodel2Package.MODIFIED_MOTOR:
				return validateModifiedMotor((ModifiedMotor)value, diagnostics, context);
			case Nxtmodel2Package.ACTION:
				return validateAction((Action)value, diagnostics, context);
			case Nxtmodel2Package.FLOW_CHART_NXT:
				return validateFlowChartNxt((FlowChartNxt)value, diagnostics, context);
			case Nxtmodel2Package.NXT_NODE:
				return validateNxtNode((NxtNode)value, diagnostics, context);
			case Nxtmodel2Package.NXT_TRANSITION:
				return validateNxtTransition((NxtTransition)value, diagnostics, context);
			case Nxtmodel2Package.METHOD:
				return validateMethod((Method)value, diagnostics, context);
			case Nxtmodel2Package.END_METHOD:
				return validateEndMethod((EndMethod)value, diagnostics, context);
			case Nxtmodel2Package.END_RULE:
				return validateEndRule((EndRule)value, diagnostics, context);
			case Nxtmodel2Package.LOOP:
				return validateLoop((Loop)value, diagnostics, context);
			case Nxtmodel2Package.END_LOOP:
				return validateEndLoop((EndLoop)value, diagnostics, context);
			case Nxtmodel2Package.START:
				return validateStart((Start)value, diagnostics, context);
			case Nxtmodel2Package.END:
				return validateEnd((End)value, diagnostics, context);
			case Nxtmodel2Package.RULE_ANNOTATION:
				return validateRuleAnnotation((RuleAnnotation)value, diagnostics, context);
			case Nxtmodel2Package.ACTION_ANNOTATION:
				return validateActionAnnotation((ActionAnnotation)value, diagnostics, context);
			default:
				return true;
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateNxtRobot(NxtRobot nxtRobot, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return validate_EveryDefaultConstraint(nxtRobot, diagnostics, context);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateNxtElement(NxtElement nxtElement, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return validate_EveryDefaultConstraint(nxtElement, diagnostics, context);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validatePart(Part part, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return validate_EveryDefaultConstraint(part, diagnostics, context);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateSensor(Sensor sensor, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return validate_EveryDefaultConstraint(sensor, diagnostics, context);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateMotor(Motor motor, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return validate_EveryDefaultConstraint(motor, diagnostics, context);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateProperty(Property property, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return validate_EveryDefaultConstraint(property, diagnostics, context);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateGear(Gear gear, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return validate_EveryDefaultConstraint(gear, diagnostics, context);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validatePort(Port port, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return validate_EveryDefaultConstraint(port, diagnostics, context);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateSensorPort(SensorPort sensorPort, DiagnosticChain diagnostics, Map<Object, Object> context) {
		if (!validate_NoCircularContainment(sensorPort, diagnostics, context)) return false;
		boolean result = validate_EveryMultiplicityConforms(sensorPort, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryDataValueConforms(sensorPort, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(sensorPort, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryBidirectionalReferenceIsPaired(sensorPort, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryProxyResolves(sensorPort, diagnostics, context);
		if (result || diagnostics != null) result &= validate_UniqueID(sensorPort, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryKeyUnique(sensorPort, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(sensorPort, diagnostics, context);
		if (result || diagnostics != null) result &= validateSensorPort_typePort(sensorPort, diagnostics, context);
		return result;
	}

	/**
	 * The cached validation expression for the typePort constraint of '<em>Sensor Port</em>'.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected static final String SENSOR_PORT__TYPE_PORT__EEXPRESSION = "self.port = 'S1' or self.port = 'S2' or self.port = 'S3' or self.port = 'S4'";

	/**
	 * Validates the typePort constraint of '<em>Sensor Port</em>'.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateSensorPort_typePort(SensorPort sensorPort, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return
			validate
				(Nxtmodel2Package.Literals.SENSOR_PORT,
				 sensorPort,
				 diagnostics,
				 context,
				 "http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot",
				 "typePort",
				 SENSOR_PORT__TYPE_PORT__EEXPRESSION,
				 Diagnostic.ERROR,
				 DIAGNOSTIC_SOURCE,
				 0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateMotorPort(MotorPort motorPort, DiagnosticChain diagnostics, Map<Object, Object> context) {
		if (!validate_NoCircularContainment(motorPort, diagnostics, context)) return false;
		boolean result = validate_EveryMultiplicityConforms(motorPort, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryDataValueConforms(motorPort, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(motorPort, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryBidirectionalReferenceIsPaired(motorPort, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryProxyResolves(motorPort, diagnostics, context);
		if (result || diagnostics != null) result &= validate_UniqueID(motorPort, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryKeyUnique(motorPort, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(motorPort, diagnostics, context);
		if (result || diagnostics != null) result &= validateMotorPort_typePort(motorPort, diagnostics, context);
		return result;
	}

	/**
	 * The cached validation expression for the typePort constraint of '<em>Motor Port</em>'.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected static final String MOTOR_PORT__TYPE_PORT__EEXPRESSION = "self.port = 'A' or self.port = 'B' or self.port = 'C'";

	/**
	 * Validates the typePort constraint of '<em>Motor Port</em>'.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateMotorPort_typePort(MotorPort motorPort, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return
			validate
				(Nxtmodel2Package.Literals.MOTOR_PORT,
				 motorPort,
				 diagnostics,
				 context,
				 "http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot",
				 "typePort",
				 MOTOR_PORT__TYPE_PORT__EEXPRESSION,
				 Diagnostic.ERROR,
				 DIAGNOSTIC_SOURCE,
				 0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateCondition(Condition condition, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return validate_EveryDefaultConstraint(condition, diagnostics, context);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateRule(Rule rule, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return validate_EveryDefaultConstraint(rule, diagnostics, context);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateModifiedMotor(ModifiedMotor modifiedMotor, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return validate_EveryDefaultConstraint(modifiedMotor, diagnostics, context);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateAction(Action action, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return validate_EveryDefaultConstraint(action, diagnostics, context);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateFlowChartNxt(FlowChartNxt flowChartNxt, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return validate_EveryDefaultConstraint(flowChartNxt, diagnostics, context);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateNxtNode(NxtNode nxtNode, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return validate_EveryDefaultConstraint(nxtNode, diagnostics, context);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateNxtTransition(NxtTransition nxtTransition, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return validate_EveryDefaultConstraint(nxtTransition, diagnostics, context);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateMethod(Method method, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return validate_EveryDefaultConstraint(method, diagnostics, context);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateEndMethod(EndMethod endMethod, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return validate_EveryDefaultConstraint(endMethod, diagnostics, context);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateEndRule(EndRule endRule, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return validate_EveryDefaultConstraint(endRule, diagnostics, context);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateLoop(Loop loop, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return validate_EveryDefaultConstraint(loop, diagnostics, context);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateEndLoop(EndLoop endLoop, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return validate_EveryDefaultConstraint(endLoop, diagnostics, context);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateStart(Start start, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return validate_EveryDefaultConstraint(start, diagnostics, context);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateEnd(End end, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return validate_EveryDefaultConstraint(end, diagnostics, context);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateRuleAnnotation(RuleAnnotation ruleAnnotation, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return validate_EveryDefaultConstraint(ruleAnnotation, diagnostics, context);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateActionAnnotation(ActionAnnotation actionAnnotation, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return validate_EveryDefaultConstraint(actionAnnotation, diagnostics, context);
	}

	/**
	 * Returns the resource locator that will be used to fetch messages for this validator's diagnostics.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public ResourceLocator getResourceLocator() {
		// TODO
		// Specialize this to return a resource locator for messages specific to this validator.
		// Ensure that you remove @generated or mark it @generated NOT
		return super.getResourceLocator();
	}

} //Nxtmodel2Validator
